<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Administrator
 * Date: 12-9-24
 * Time: 下午6:24
 * To change this template use File | Settings | File Templates.
 */
class SORT{
    private $db;
    private $sortdata;//当前数据
    public $sortField;//排序的字段名称
    public $table;
    public $where;


    function __construct($db){
        $this->db=$db;
    }
    function prev(){//往前
        $sql="";

    }
    function nex(){//往后


    }
    function top(){//置顶


    }
    function bottom(){//置底


    }
    function to(){//翻转到指定位置


    }
    /////一下为私有方法
    private function _data(){//
        $sql="select ".$this->sortField." from  ".$this->table." where 1=1 ".$this->where." order by ".$this->sortField;
        $result=$this->db->query_all($sql);
        $this->sortdata=$result;
    }
    private function _istop($currentpos){//是否在顶部
        $result=$this->sortdata;
        if($result[$this->sortField]==$currentpos){
            return true;
        }else{
            return false;
        }
    }
    private function _isbottom($currentpos){//是否在底部
        $result=$this->sortdata;
        if($result[$this->sortField]==$currentpos){
            return true;
        }else{
            return false;
        }
    }
}